package tor;

import org.silvertunnel.netlib.api.NetLayer;
import org.silvertunnel.netlib.api.NetSocket;

public class TorSender implements Runnable
{
    String msg;
    boolean isrunning = true;

    public TorSender( String msg )
    {
        this.msg = msg;
    }

    static int port = 6677;
    static String host = "89.75.50.95";
    volatile String result = null;

    public void run()
    {
        try
        {
            Client2 c = new Client2();
            NetLayer nl = c.makeNetLayer();
            NetSocket ns = c.connect( host, port, nl );
            c.write( ns, msg );
            Thread.sleep( 1000 );
            result = c.read( ns );
            System.out.println( result );
            isrunning = false;
        }
        catch( Exception e )
        {
            System.out.println( "exception" );
            isrunning = false;
        }
        isrunning = false;
    }

    public String getResult()
    {
        return result;
    }

    public boolean isRunning()
    {
        return isrunning;
    }
}
